package com.windward.vii.dao.mapper;

import com.windward.vii.dao.entity.AssetUserRecharge;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface AssetUserRechargeMapper {
    @Delete({
        "delete from asset_user_recharge",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    @Insert({
        "insert into asset_user_recharge (id, uid, amount, ",
        "coin, order_id, pay_type, ",
        "terminal_type, create_time)",
        "values (#{id,jdbcType=BIGINT}, #{uid,jdbcType=BIGINT}, #{amount,jdbcType=INTEGER}, ",
        "#{coin,jdbcType=INTEGER}, #{orderId,jdbcType=BIGINT}, #{payType,jdbcType=TINYINT}, ",
        "#{terminalType,jdbcType=TINYINT}, #{createTime,jdbcType=TIMESTAMP})"
    })
    int insert(AssetUserRecharge record);

    int insertSelective(AssetUserRecharge record);

    @Select({
        "select",
        "id, uid, amount, coin, order_id, pay_type, terminal_type, create_time",
        "from asset_user_recharge",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @ResultMap("BaseResultMap")
    AssetUserRecharge selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(AssetUserRecharge record);

    @Update({
        "update asset_user_recharge",
        "set uid = #{uid,jdbcType=BIGINT},",
          "amount = #{amount,jdbcType=INTEGER},",
          "coin = #{coin,jdbcType=INTEGER},",
          "order_id = #{orderId,jdbcType=BIGINT},",
          "pay_type = #{payType,jdbcType=TINYINT},",
          "terminal_type = #{terminalType,jdbcType=TINYINT},",
          "create_time = #{createTime,jdbcType=TIMESTAMP}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(AssetUserRecharge record);
}